﻿<?xml version="1.0" encoding="utf-8" ?>
<rules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       replacementText="¤"
       unmatchedAction="EmitReplacement"
       author="Kirk"
       title="Sindarin Tehtar"
       copyright="Open source distributed without warranty of any kind"
       caseSensitive="false"
       xmlns="http://transcriber.codeplex.com/Rules.xsd">

  <!-- PUT INPUT INTO CANONICAL FORM BEFORE TRANSCRIPTION -->

  <!-- replace c with k -->
  <rule pattern="c">
    <intermediate>k</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[äâà]">
    <intermediate>a</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[ëêè]">
    <intermediate>e</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[ïîì]">
    <intermediate>i</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[öôò]">
    <intermediate>o</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[üûù]">
    <intermediate>u</intermediate>
  </rule>

  <!-- replace æ with separate a and e -->
  <rule pattern="æ">
    <intermediate>ae</intermediate>
  </rule>

  <!-- set up for initial yanta (io- ia- etc.) -->
  <rule pattern="(?&lt;whitespace&gt;^|\s)+i(?&lt;vowel&gt;[aeiou])(?&lt;consonant&gt;[a-z-[aeiou]])">
    <intermediate>${whitespace}¤${vowel}${consonant}</intermediate>
  </rule>

  <!-- set up for long óre (final rr) -->
  <rule pattern="rr(?&lt;whitespace&gt;$|\s+|\p{P})">
    <intermediate>©©${whitespace}</intermediate>
  </rule>

  <!-- set up for óre (final r) -->
  <rule pattern="r(?&lt;whitespace&gt;$|\s+|\p{P})">
    <intermediate>©${whitespace}</intermediate>
  </rule>

  <!-- NUMBERS -->

  <import filename="TengwarNumerals.xml"/>

  <!-- DIPHTHONGS -->

  <rule pattern="ai">
    <final>hE</final>
  </rule>

  <rule pattern="ei">
    <final>hY</final>
  </rule>

  <rule pattern="ui">
    <final>hU</final>
  </rule>

  <rule pattern="ae">
    <final>lE</final>
  </rule>

  <rule pattern="oe">
    <final>lR</final>
  </rule>
  
  <!-- COMPOUND CONSONANTS -->

  <rule pattern="ath">
    <final>3D</final>
  </rule>

  <rule pattern="eth">
    <final>3F</final>
  </rule>

  <rule pattern="ith">
    <final>3G</final>
  </rule>

  <rule pattern="oth">
    <final>3H</final>
  </rule>

  <rule pattern="uth">
    <final>3J</final>
  </rule>

  <rule pattern="th">
    <final>3</final>
  </rule>

  <rule pattern="akh">
    <final>c#</final>
  </rule>

  <rule pattern="ekh">
    <final>c$</final>
  </rule>

  <rule pattern="ikh">
    <final>c%</final>
  </rule>

  <rule pattern="okh">
    <final>c^</final>
  </rule>

  <rule pattern="ukh">
    <final>c&amp;</final>
  </rule>

  <rule pattern="kh">
    <final>c</final>
  </rule>

  <rule pattern="adh">
    <final>4E</final>
  </rule>

  <rule pattern="edh">
    <final>4R</final>
  </rule>

  <rule pattern="idh">
    <final>4T</final>
  </rule>

  <rule pattern="odh">
    <final>4Y</final>
  </rule>

  <rule pattern="udh">
    <final>4U</final>
  </rule>

  <rule pattern="dh">
    <final>4</final>
  </rule>

  <rule pattern="agh">
    <final>v#</final>
  </rule>

  <rule pattern="egh">
    <final>v$</final>
  </rule>

  <rule pattern="igh">
    <final>v%</final>
  </rule>

  <rule pattern="ogh">
    <final>v^</final>
  </rule>

  <rule pattern="ugh">
    <final>v&amp;</final>
  </rule>

  <rule pattern="gh">
    <final>v</final>
  </rule>

  <rule pattern="ang">
    <final>b#</final>
  </rule>

  <rule pattern="eng">
    <final>b$</final>
  </rule>

  <rule pattern="ing">
    <final>b%</final>
  </rule>

  <rule pattern="ong">
    <final>b^</final>
  </rule>

  <rule pattern="ung">
    <final>b&amp;</final>
  </rule>

  <rule pattern="ng">
    <final>b</final>
  </rule>

  <rule pattern="arh">
    <final>uE</final>
  </rule>

  <rule pattern="erh">
    <final>uR</final>
  </rule>

  <rule pattern="irh">
    <final>uT</final>
  </rule>

  <rule pattern="orh">
    <final>uY</final>
  </rule>

  <rule pattern="urh">
    <final>uU</final>
  </rule>

  <rule pattern="rh">
    <final>u</final>
  </rule>

  <rule pattern="alh">
    <final>mE</final>
  </rule>

  <rule pattern="elh">
    <final>mR</final>
  </rule>

  <rule pattern="ilh">
    <final>mT</final>
  </rule>

  <rule pattern="olh">
    <final>mY</final>
  </rule>

  <rule pattern="ulh">
    <final>mU</final>
  </rule>

  <rule pattern="lh">
    <final>m</final>
  </rule>
  
  <!-- SIMPLE CONSONANTS -->

  <rule pattern="att">
    <final>1/E</final>
  </rule>

  <rule pattern="ett">
    <final>1/R</final>
  </rule>

  <rule pattern="itt">
    <final>1/T</final>
  </rule>

  <rule pattern="ott">
    <final>1/Y</final>
  </rule>

  <rule pattern="utt">
    <final>1/U</final>
  </rule>

  <rule pattern="tt">
    <final>1/</final>
  </rule>

  <rule pattern="at">
    <final>1E</final>
  </rule>

  <rule pattern="et">
    <final>1R</final>
  </rule>

  <rule pattern="it">
    <final>1T</final>
  </rule>

  <rule pattern="ot">
    <final>1Y</final>
  </rule>

  <rule pattern="ut">
    <final>1U</final>
  </rule>

  <rule pattern="t">
    <final>1</final>
  </rule>

  <rule pattern="app">
    <final>q/E</final>
  </rule>

  <rule pattern="epp">
    <final>q/R</final>
  </rule>

  <rule pattern="ipp">
    <final>q/T</final>
  </rule>

  <rule pattern="opp">
    <final>q/Y</final>
  </rule>

  <rule pattern="upp">
    <final>q/U</final>
  </rule>

  <rule pattern="pp">
    <final>q/</final>
  </rule>

  <rule pattern="ap">
    <final>qE</final>
  </rule>

  <rule pattern="ep">
    <final>qR</final>
  </rule>

  <rule pattern="ip">
    <final>qT</final>
  </rule>

  <rule pattern="op">
    <final>qY</final>
  </rule>

  <rule pattern="up">
    <final>qU</final>
  </rule>

  <rule pattern="p">
    <final>q</final>
  </rule>

  <rule pattern="akk">
    <final>z/E</final>
  </rule>

  <rule pattern="ekk">
    <final>z/R</final>
  </rule>

  <rule pattern="ikk">
    <final>z/T</final>
  </rule>

  <rule pattern="okk">
    <final>z/Y</final>
  </rule>

  <rule pattern="ukk">
    <final>z/U</final>
  </rule>

  <rule pattern="kk">
    <final>z/</final>
  </rule>

  <rule pattern="ak">
    <final>zE</final>
  </rule>

  <rule pattern="ek">
    <final>zR</final>
  </rule>

  <rule pattern="ik">
    <final>zT</final>
  </rule>

  <rule pattern="ok">
    <final>zY</final>
  </rule>

  <rule pattern="uk">
    <final>zU</final>
  </rule>

  <rule pattern="k">
    <final>z</final>
  </rule>

  <rule pattern="add">
    <final>2?#</final>
  </rule>

  <rule pattern="edd">
    <final>2?$</final>
  </rule>

  <rule pattern="idd">
    <final>2?%</final>
  </rule>

  <rule pattern="odd">
    <final>2?^</final>
  </rule>

  <rule pattern="udd">
    <final>2?&amp;</final>
  </rule>

  <rule pattern="dd">
    <final>2?</final>
  </rule>

  <rule pattern="ad">
    <final>2#</final>
  </rule>

  <rule pattern="ed">
    <final>2$</final>
  </rule>

  <rule pattern="id">
    <final>2%</final>
  </rule>

  <rule pattern="od">
    <final>2^</final>
  </rule>

  <rule pattern="ud">
    <final>2&amp;</final>
  </rule>

  <rule pattern="d">
    <final>2</final>
  </rule>

  <rule pattern="abb">
    <final>w?#</final>
  </rule>

  <rule pattern="ebb">
    <final>w?$</final>
  </rule>

  <rule pattern="ibb">
    <final>w?%</final>
  </rule>

  <rule pattern="obb">
    <final>w?^</final>
  </rule>

  <rule pattern="ubb">
    <final>w?&amp;</final>
  </rule>

  <rule pattern="bb">
    <final>w?</final>
  </rule>

  <rule pattern="ab">
    <final>w#</final>
  </rule>

  <rule pattern="eb">
    <final>w$</final>
  </rule>

  <rule pattern="ib">
    <final>w%</final>
  </rule>

  <rule pattern="ob">
    <final>w^</final>
  </rule>

  <rule pattern="ub">
    <final>w&amp;</final>
  </rule>

  <rule pattern="b">
    <final>w</final>
  </rule>

  <rule pattern="agg">
    <final>x?#</final>
  </rule>

  <rule pattern="egg">
    <final>x?$</final>
  </rule>

  <rule pattern="igg">
    <final>x?%</final>
  </rule>

  <rule pattern="ogg">
    <final>x?^</final>
  </rule>

  <rule pattern="ugg">
    <final>x?&amp;</final>
  </rule>

  <rule pattern="gg">
    <final>x?</final>
  </rule>

  <rule pattern="ag">
    <final>x#</final>
  </rule>

  <rule pattern="eg">
    <final>x$</final>
  </rule>

  <rule pattern="ig">
    <final>x%</final>
  </rule>

  <rule pattern="og">
    <final>x^</final>
  </rule>

  <rule pattern="ug">
    <final>x&amp;</final>
  </rule>

  <rule pattern="g">
    <final>x</final>
  </rule>

  <rule pattern="aff">
    <final>e/C</final>
  </rule>

  <rule pattern="eff">
    <final>e/V</final>
  </rule>

  <rule pattern="iff">
    <final>e/B</final>
  </rule>

  <rule pattern="off">
    <final>e/N</final>
  </rule>

  <rule pattern="uff">
    <final>e/M</final>
  </rule>

  <rule pattern="ff">
    <final>e/</final>
  </rule>

  <rule pattern="af">
    <final>eC</final>
  </rule>

  <rule pattern="ef">
    <final>eV</final>
  </rule>

  <rule pattern="if">
    <final>eB</final>
  </rule>

  <rule pattern="of">
    <final>eN</final>
  </rule>

  <rule pattern="uf">
    <final>eM</final>
  </rule>

  <rule pattern="f">
    <final>e</final>
  </rule>

  <rule pattern="avv">
    <final>r?E</final>
  </rule>

  <rule pattern="evv">
    <final>r?R</final>
  </rule>

  <rule pattern="ivv">
    <final>r?T</final>
  </rule>

  <rule pattern="ovv">
    <final>r?Y</final>
  </rule>

  <rule pattern="uvv">
    <final>r?U</final>
  </rule>

  <rule pattern="vv">
    <final>r?</final>
  </rule>

  <rule pattern="av">
    <final>rE</final>
  </rule>

  <rule pattern="ev">
    <final>rR</final>
  </rule>

  <rule pattern="iv">
    <final>rT</final>
  </rule>

  <rule pattern="ov">
    <final>rY</final>
  </rule>

  <rule pattern="uv">
    <final>rU</final>
  </rule>

  <rule pattern="v">
    <final>r</final>
  </rule>

  <rule pattern="ann">
    <final>5?#</final>
  </rule>

  <rule pattern="enn">
    <final>5?$</final>
  </rule>

  <rule pattern="inn">
    <final>5?%</final>
  </rule>

  <rule pattern="onn">
    <final>5?^</final>
  </rule>

  <rule pattern="unn">
    <final>5?&amp;</final>
  </rule>

  <rule pattern="nn">
    <final>5?</final>
  </rule>

  <rule pattern="an">
    <final>5#</final>
  </rule>

  <rule pattern="en">
    <final>5$</final>
  </rule>

  <rule pattern="in">
    <final>5%</final>
  </rule>

  <rule pattern="on">
    <final>5^</final>
  </rule>

  <rule pattern="un">
    <final>5&amp;</final>
  </rule>

  <rule pattern="n">
    <final>5</final>
  </rule>

  <rule pattern="amm">
    <final>b?#</final>
  </rule>

  <rule pattern="emm">
    <final>b?$</final>
  </rule>

  <rule pattern="imm">
    <final>b?%</final>
  </rule>

  <rule pattern="omm">
    <final>b?^</final>
  </rule>

  <rule pattern="umm">
    <final>b?&amp;</final>
  </rule>

  <rule pattern="mm">
    <final>b?</final>
  </rule>

  <rule pattern="am">
    <final>b#</final>
  </rule>

  <rule pattern="em">
    <final>b$</final>
  </rule>

  <rule pattern="im">
    <final>b%</final>
  </rule>

  <rule pattern="om">
    <final>b^</final>
  </rule>

  <rule pattern="um">
    <final>b&amp;</final>
  </rule>

  <rule pattern="m">
    <final>b</final>
  </rule>

  <rule pattern="a©©">
    <final>6/E</final>
  </rule>

  <rule pattern="e©©">
    <final>6/R</final>
  </rule>

  <rule pattern="i©©">
    <final>6/T</final>
  </rule>

  <rule pattern="o©©">
    <final>6/Y</final>
  </rule>

  <rule pattern="u©©">
    <final>6/U</final>
  </rule>

  <rule pattern="©©">
    <final>6/</final>
  </rule>

  <rule pattern="a©">
    <final>6E</final>
  </rule>

  <rule pattern="e©">
    <final>6R</final>
  </rule>

  <rule pattern="i©">
    <final>6T</final>
  </rule>

  <rule pattern="o©">
    <final>6Y</final>
  </rule>

  <rule pattern="u©">
    <final>6U</final>
  </rule>

  <rule pattern="©">
    <final>6</final>
  </rule>

  <rule pattern="arr">
    <final>7/E</final>
  </rule>

  <rule pattern="err">
    <final>7/R</final>
  </rule>

  <rule pattern="irr">
    <final>7/T</final>
  </rule>

  <rule pattern="orr">
    <final>7/Y</final>
  </rule>

  <rule pattern="urr">
    <final>7/Y</final>
  </rule>

  <rule pattern="rr">
    <final>7/</final>
  </rule>

  <rule pattern="ar">
    <final>7E</final>
  </rule>

  <rule pattern="er">
    <final>7R</final>
  </rule>

  <rule pattern="ir">
    <final>7T</final>
  </rule>

  <rule pattern="or">
    <final>7Y</final>
  </rule>

  <rule pattern="ur">
    <final>7U</final>
  </rule>

  <rule pattern="r">
    <final>7</final>
  </rule>

  <rule pattern="aww">
    <final>y/E</final>
  </rule>

  <rule pattern="eww">
    <final>y/R</final>
  </rule>

  <rule pattern="iww">
    <final>y/T</final>
  </rule>

  <rule pattern="oww">
    <final>y/Y</final>
  </rule>

  <rule pattern="uww">
    <final>y/Y</final>
  </rule>

  <rule pattern="ww">
    <final>y/</final>
  </rule>

  <rule pattern="aw">
    <final>yE</final>
  </rule>

  <rule pattern="ew">
    <final>yR</final>
  </rule>

  <rule pattern="iw">
    <final>yT</final>
  </rule>

  <rule pattern="ow">
    <final>yY</final>
  </rule>

  <rule pattern="uw">
    <final>yU</final>
  </rule>

  <rule pattern="w">
    <final>y</final>
  </rule>

  <rule pattern="ahh">
    <final>9/¯</final>
  </rule>

  <rule pattern="ehh">
    <final>9/F</final>
  </rule>

  <rule pattern="ihh">
    <final>9/G</final>
  </rule>

  <rule pattern="ohh">
    <final>9/H</final>
  </rule>

  <rule pattern="uhh">
    <final>9/J</final>
  </rule>

  <rule pattern="hh">
    <final>9/</final>
  </rule>

  <rule pattern="ah">
    <final>9¯</final>
  </rule>

  <rule pattern="eh">
    <final>9F</final>
  </rule>

  <rule pattern="ih">
    <final>9G</final>
  </rule>

  <rule pattern="oh">
    <final>9H</final>
  </rule>

  <rule pattern="uh">
    <final>9J</final>
  </rule>

  <rule pattern="h">
    <final>9</final>
  </rule>

  <rule pattern="ass">
    <final>,E</final>
  </rule>

  <rule pattern="ess">
    <final>,R</final>
  </rule>

  <rule pattern="iss">
    <final>,T</final>
  </rule>

  <rule pattern="oss">
    <final>,Y</final>
  </rule>

  <rule pattern="uss">
    <final>,U</final>
  </rule>

  <rule pattern="ss">
    <final>k</final>
  </rule>

  <rule pattern="as">
    <final>iE</final>
  </rule>

  <rule pattern="es">
    <final>iR</final>
  </rule>

  <rule pattern="is">
    <final>iT</final>
  </rule>

  <rule pattern="os">
    <final>iY</final>
  </rule>

  <rule pattern="us">
    <final>iU</final>
  </rule>

  <rule pattern="s">
    <final>8</final>
  </rule>

  <rule pattern="all">
    <final>j¸E</final>
  </rule>

  <rule pattern="ell">
    <final>j¸R</final>
  </rule>

  <rule pattern="ill">
    <final>j¸T</final>
  </rule>

  <rule pattern="oll">
    <final>j¸Y</final>
  </rule>

  <rule pattern="ull">
    <final>j¸U</final>
  </rule>

  <rule pattern="ll">
    <final>j¸</final>
  </rule>

  <rule pattern="al">
    <final>jE</final>
  </rule>

  <rule pattern="el">
    <final>jR</final>
  </rule>

  <rule pattern="il">
    <final>jT</final>
  </rule>

  <rule pattern="ol">
    <final>jY</final>
  </rule>

  <rule pattern="ul">
    <final>jU</final>
  </rule>

  <rule pattern="l">
    <final>j</final>
  </rule>
  
  <!-- LONG VOWELS -->

  <rule pattern="á">
    <final>~C</final>
  </rule>

  <rule pattern="é">
    <final>~V</final>
  </rule>

  <rule pattern="í">
    <final>~B</final>
  </rule>

  <rule pattern="ó">
    <final>~N</final>
  </rule>

  <rule pattern="ú">
    <final>~M</final>
  </rule>
  
  <!-- SHORT VOWELS -->

  <rule pattern="a">
    <final>`C</final>
  </rule>

  <rule pattern="e">
    <final>`V</final>
  </rule>

  <rule pattern="i">
    <final>`B</final>
  </rule>

  <rule pattern="o">
    <final>`N</final>
  </rule>

  <rule pattern="u">
    <final>`M</final>
  </rule>

  <rule pattern="ə">
    <final>¼</final>
  </rule>

  <rule pattern="¤">
    <final>l</final>
  </rule>

  <!-- WHITESPACE / PUNCTUATION -->

  <rule pattern="(\s+)">
    <final>$1</final>
  </rule>

  <rule pattern="!">
    <final>Á</final>
  </rule>

  <rule pattern="\?">
    <final>À</final>
  </rule>

  <rule pattern="\p{Ps}|\p{Pe}">
    <final>›</final>
  </rule>

  <rule pattern="\p{Pd}">
    <final>Â</final>
  </rule>

  <rule pattern=",">
    <final>ˆ</final>
  </rule>

  <rule pattern="\.">
    <final>=</final>
  </rule>

</rules>